const webpack = require('webpack'); //引入配置文件


var config = {

    entry: {
        index: './index.ts' //入口文件
    },
    output: { //打包自后出口文件
        path: __dirname + '/dist',
        filename: 'index.js', //输入文件
        publicPath: "dist" //要用静态内容在前面加上这个路由
    },
    devtool: 'none',
    devServer: {
        contentBase: __dirname, //本地服务器所加载的页面所在的目录
        historyApiFallback: true, //路由不跳转
        inline: true, //实时刷新
        hot: false,
    },
    module: {
        rules: [{
                test: /\.(js|ts|tsx)$/,
                loader: 'babel-loader',
            },
            {
                test: /\.(js|ts|tsx)$/,
                use: [{
                    loader: 'ts-loader',
                    options: {
                        transpileOnly: true
                    }
                }]
            },
        ]
    },
    resolve: {
        extensions: [".js", ".ts", ".tsx"] //默认值       //默认扩展名
    },
    plugins: [ //插件机制
        //  new webpack.HotModuleReplacementPlugin()
    ],
}
module.exports = config;